<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
       <script type='text/javascript' src='dwr/interface/Demo.js'></script>
        <script type='text/javascript' src='dwr/engine.js'></script>
        <script type='text/javascript' src='dwr/util.js'></script>       
    </head>
    <body onload="initTimers()">
        <h2>DWR Demo</h2>
        <input id="prefix" type=text onkeyup='getDemoData()'/>
        <br>
        <span id="result"></span>
        
        <hr>
        
        <h2>Monitor Demo</h2>
        <div>
			<a alt="" style="cursor:hand " href="javascript:contrlTimmers();">
				停止刷新
			</a> 
        </div>
        <div>
        	<br>
	        parseCount：<span id="parseCount">0</span>
	        <br>        
	        matchCount：<span id="matchCount">0</span>        
        </div>
        <div>
        	<br>
	        crmCount：<span id="crmCount">0</span>
	        <br>        
	        iomCount：<span id="iomCount">0</span>        
        </div>
        
    </body>
</html>
<script type='text/javascript'>
	var updateStepStatisTimmer =null;
	var updateInterStatisTimmer =null;
	function initTimers(){
		updateStepStatisTimmer =startTimmer( "getStepStatisInfoMap()", 5);//5秒钟提取一次数据
		updateInterStatisTimmer =startTimmer( "getInterStatisInfoMap()", 5);//5秒钟提取一次数据
	}
	function startTimmer( funName, interVal){
		return window.setInterval( funName, 1000*interVal);
	}
	function stopTimmers(){
		window.clearInterval( updateStepStatisTimmer);
		window.clearInterval( updateInterStatisTimmer);
	}
</script>
<script type='text/javascript'>
   function getDemoData() {
        var input = dwr.util.getValue("prefix");
        //alert("input="+input);
        Demo.getData(input, function(data) {
                dwr.util.setValue("result", data);
        });
    }

   function getStepStatisInfoMap() {
        Demo.getStepStatisInfoMap(function(data) {
                dwr.util.setValue("parseCount", data.parseCount);
                dwr.util.setValue("matchCount", data.matchCount);
        });
    }

   function getInterStatisInfoMap() {
        Demo.getInterStatisInfoMap(function(data) {
                dwr.util.setValue("crmCount", data.crmCount);
                dwr.util.setValue("iomCount", data.iomCount);
        });
    }
</script>